#include "head.h"
/* Usage:  */
bool file_exist(char *path, char *file_name)
{
    if(!strcmp(file_name, "~")){
        return true;
    }
    DIR *dirp = opendir(path);
    ERROR_CHECK(dirp, NULL, "opendir");

    struct dirent *pdirent;

    //遍历所在路径下的文件
    while((pdirent = readdir(dirp)) != NULL){
        //找到文件，结束循环，继续往下走
        if(strcmp(file_name, pdirent->d_name) == 0){
            printf("存在%s文件\n", file_name);
            return true;
            break;

        }
    }
    printf("文件不存在\n");

    return false;
}

